package itbour.onetouchshow.utils.compress;

import android.content.Context;

import com.qiniu.pili.droid.shortvideo.PLShortVideoTranscoder;
import com.qiniu.pili.droid.shortvideo.PLVideoSaveListener;

/**
 * Created by guoh on 2018/7/10.
 * 功能描述：压缩工具类
 * 需要的参数：
 */
public class CompressUtil {

    public void startQiNiuCompress(Context context, String inputPath, String outputPath, int width, int height, int bitrate) {
        PLShortVideoTranscoder mShortVideoTranscoder = new PLShortVideoTranscoder(context, inputPath, outputPath);
        mShortVideoTranscoder.transcode(width, height, bitrate, 0, false, new PLVideoSaveListener() {
            @Override
            public void onSaveVideoSuccess(final String s) {
            }

            @Override
            public void onSaveVideoFailed(final int errorCode) {

            }

            @Override
            public void onSaveVideoCanceled() {
            }

            @Override
            public void onProgressUpdate(final float percentage) {
                int percent = (int) (100 * percentage);

            }
        });
    }

    private void startMediaCodeCompress(String inputPath, String outputPath, int width, int height, int bitrate) {
        VideoCompress.compressVideoWithBitRate(width, height, bitrate, inputPath, outputPath, new VideoCompress.CompressListener() {
            @Override
            public void onStart() {

            }

            @Override
            public void onSuccess() {

            }

            @Override
            public void onFail() {
            }

            @Override
            public void onProgress(float percent) {

            }
        });
    }
}
